package designpattern.prototype;


//克隆羊问题,要求生产多个相同的羊
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
//        Sheep sheep1 = new Sheep("tom",1,"white");
//        sheep1.setToy(new Toy("玩具","红色"));
//        Sheep sheep2 = sheep1.clone();
//        System.out.println(sheep1);
//        System.out.println(sheep2);
//        System.out.println(sheep1==sheep2);
//        System.out.println(sheep1.getToy()==sheep2.getToy());

        Person person = new Person("zs",20,new Toy("电脑","黑色"));
        Person person1 = person.clone2();

        System.out.println(person);
        System.out.println(person1);
        System.out.println(person.getToy()==person1.getToy());
    }
}
